#include "classnode.h"

void ClassNode::write(GraphStream * s)
{
 this->accept(s);
 char * modtext=" ";
 if (type()==CLM_DEFERRED) modtext="DEFERRED ";
 if (type()==CLM_FROZEN)   modtext="FROZEN ";
 fprintf(s->stream,"\tnode_%d [ label=\"(%d,%d)\\n%s CLASS %s\" shape=\"rectangle\"]\n",this->number(),this->line(),this->position(),modtext,this->name().c_str());
 if (m_inherits)
 {
  if (m_inherits->vector().size()!=0)
  {
   this->m_inherits->write(s);
   fprintf(s->stream,"\tnode_%d -> node_%d [label=\"inherits\"]\n",this->number(), this->m_inherits->number());
  }
 }
 if (m_creators)
 {
  if (m_creators->vector().size()!=0)
  {
   this->m_creators->write(s);
   fprintf(s->stream,"\tnode_%d -> node_%d [label=\"creators\"]\n",this->number(), this->m_creators->number());
  }
 }
 if (m_converters)
 {
  if (m_converters->vector().size()!=0)
  {
   this->m_converters->write(s);
   fprintf(s->stream,"\tnode_%d -> node_%d [label=\"converters\"]\n",this->number(), this->m_converters->number());
  }
 }
 if (m_features)
 {
  if (m_features->vector().size()!=0)
  {
   this->m_features->write(s);
   fprintf(s->stream,"\tnode_%d -> node_%d [label=\"feature groups\"]\n",this->number(), this->m_features->number());
  }
 }
}
